#include <iostream>
#include <string>
#include <cstdio>
#include <ctime>

//#include <GL/glut.h>

#include "objobject.h"
#include "vertex.h"
#include "vertexnormal.h"
#include "triangle.h"
#include "common.h"

#include "objanim.h"

using namespace std;

OBJAnim::OBJAnim() {
//	m_vertexCounter = 0;
//	m_vertexCount = 0;
//	m_triangleCount = 0;
//	m_vertexNormalCount = 0;
//	m_texcoordsCount = 0;

	//object invisible by default
	m_visible = 0;
	m_animationEnabled = 0;
	m_lastFrame = 1;
}

OBJAnim::~OBJAnim() {

}

void OBJAnim::setUniqName(std::string uniqName) {
        m_uniqName = uniqName;
}

OBJObject* OBJAnim::getFrame(int i) {
//	 std::cout << "OBJAnim::getFrame: looking for frame: " << i << std::endl;
	m_lastFrame = i;
        std::list <OBJObject*>::iterator objIt;
        for (objIt=m_objobjectList.begin(); objIt != m_objobjectList.end(); objIt++) {
//		std::cout << "obj frame num = " << objIt->frameNum << std::endl;
		if ((*objIt)->frameNum == i) {
//			 std::cout << "obj with frame number " << (*objIt)->frameNum << " found!" << std::endl;
			return (*objIt);
		}

	}
	return NULL;
}

void OBJAnim::setWorldCoords(GLfloat x, GLfloat y, GLfloat z) {
	m_worldX = x;
	m_worldY = y;
	m_worldZ = z;

}

void OBJAnim::enableAnim(void) {
	m_animationEnabled = 1;
}

void OBJAnim::disableAnim(void) {
	m_animationEnabled = 0;
}
